package com.kool.kadmin.system.api.vo;

import com.kool.kadmin.system.bean.SysUserDo;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * @author luyu
 */
@Data
@Accessors(chain = true)
public class UserVo {
    private Long id;
    private String loginName;
    private String userName;
    private String phone;
    private String email;
    private String avatar;
    private Integer state;
    private Integer errorTimes;
    private Date createdTime;
    private String svnUser;
    private String svnPwd;

    /**
     * Do转Vo
     *
     * @param userDo
     * @return
     */
    public static UserVo toUserVo(SysUserDo userDo) {
        UserVo userVo = new UserVo();
        userVo.setId(userDo.getId())
                .setLoginName(userDo.getLoginName())
                .setUserName(userDo.getUserName())
                .setPhone(userDo.getPhone())
                .setEmail(userDo.getEmail())
                .setAvatar(userDo.getAvatar())
                .setState(userDo.getState())
                .setErrorTimes(userDo.getErrorTimes())
                .setCreatedTime(userDo.getCreatedTime())
                .setSvnUser(userDo.getSvnUser());
        return userVo;
    }
}
